﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pyramid.Models
{
	/// <summary>
	/// 员工工资主表
	/// </summary>
	public class StaffSalaryMaster
	{
		public int Id { get; set; }

		[Display(Name = "年份")]
		public int Year { get; set; }

		[Display(Name = "月份")]
		public int Month { get; set; }

		[Display(Name = "状态")]
		public int Status { get; set; }

		[NotMapped]
		public FinanceStatus StatusEnum
		{
			get { return (FinanceStatus) Status; }
		}

		[Display(Name = "建档日期")]
		public DateTime CreateTime { get; set; }

		[Display(Name = "建档人")]
		[MaxLength(20)]
		public string CreateUserId { get; set; }

		public virtual ICollection<StaffSalarySummary> Summaries { get; set; }
		public virtual ICollection<StaffSalaryDetail> Details { get; set; }
	}

	public class StaffSalarySummaryDto
	{
		public int Id { get; set; }
		public int StaffId { get; set; }
		public int MasterId { get; set; }

		[Display(Name = "总工资")]
		public decimal Total { get; set; }

		[Display(Name = "状态")]
		public int Status { get; set; }
	}

	/// <summary>
	/// 员工薪资汇总表
	/// </summary>
	public class StaffSalarySummary : StaffSalarySummaryDto
	{
		[ForeignKey("StaffId")]
		public virtual Staff Staff { get; set; }

		[ForeignKey("MasterId")]
		public virtual StaffSalaryMaster Master { get; set; }

	}

	/// <summary>
	/// 员工薪资明细表
	/// </summary>
	public class StaffSalaryDetail : StaffSalaryDetailDto
	{
		[ForeignKey("MasterId")]
		public virtual StaffSalaryMaster Master { get; set; }

		[ForeignKey("SettingId")]
		public virtual StaffSalarySetDetail SettingDetail { get; set; }
	}

	public class StaffSalaryDetailDto
	{
		public int Id { get; set; }

		public int MasterId { get; set; }
		public int StaffId { get; set; }
		public int PartId { get; set; }
		public decimal Value { get; set; }
		public int SettingId { get; set; }
	}
}